gtkentrycompletion: check return value because It can be non-UTF8
authorJavier Jardón <jjardon@gnome.org>
Mon, 19 Jul 2010 18:45:25 +0000 (20:45 +0200)
committerJavier Jardón <jjardon@gnome.org>
Mon, 19 Jul 2010 21:56:22 +0000 (23:56 +0200)
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=624270

gtk/gtkentrycompletion.c

index 3bd43fb06997060120adbc7f3c17b831c8eb31b1..8d066bc211b786ed57df0d97aa9eb1106db93d98 100644 (file)
@@ -790,15 +790,19 @@ gtk_entry_completion_default_completion_func (GtkEntryCompletion *completion,
   if (item != NULL)
     {
       normalized_string = g_utf8_normalize (item, -1, G_NORMALIZE_ALL);
-      case_normalized_string = g_utf8_casefold (normalized_string, -1);
-      
-      if (!strncmp (key, case_normalized_string, strlen (key)))
-       ret = TRUE;
-      
-      g_free (item);
+
+      if (normalized_string != NULL)
+        {
+          case_normalized_string = g_utf8_casefold (normalized_string, -1);
+
+          if (!strncmp (key, case_normalized_string, strlen (key)))
+           ret = TRUE;
+
+          g_free (case_normalized_string);
+        }
       g_free (normalized_string);
-      g_free (case_normalized_string);
     }
+  g_free (item);
 
   return ret;
 }